package com.taiji.test;

/**
 * 图形打印
 */
public class Question_1 {
    /**
     * 图形打印
     * 当number = 1 =>*
     * 当number = 2 =>  **
     * **
     * 当number = 3 =>  ***
     * ***
     * ***
     * 当number = 5 =>  * * * * *
     * * *   * *
     * *   *   *
     * * *   * *
     * * * * * *
     * <p>
     * 当number = 6 =>  * * * * * *
     * * *     * *
     * *   * *   *
     * *   * *   *
     * * *     * *
     * * * * * * *
     *
     * @param number 长度
     */
    public static void handle(int number) {
        for (int i = 0; i < number; i++) {
            for (int j = 0; j < number; j++) {
                if (i == 0 || j == 0 || i == (number - 1) || j == (number - 1) || i == j || (number -1 - i) == j) {
                    System.out.print("* ");
                } else {
                    System.out.print("  ");
                }
            }
            System.out.println("");
        }
    }

    public static void main(String[] args) {
        handle(7);
    }
}
